package com.hgyc.mom.base.entity;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.*;

import com.hgyc.mom.common.annotation.Excel;
import com.hgyc.mom.core.annotation.DictColumn;
import com.hgyc.mom.core.annotation.TableDict;
import com.hgyc.mom.core.mybatis.EQ;
import com.hgyc.mom.core.mybatis.Like;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

/**
 * <p>
 * 产品BOM
 * </p>
 *
 * @author fwj
 * @since 2025-07-10
 */
@Data
@TableName("base_bom_item")
@Schema(name="产品BOM对象", description="产品BOM对象")
public class BomItem implements Serializable {
    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @Schema(description = "流水号")
    private Long id;

    @Excel(name = "物料产品ID")
    @EQ
    @Schema(description = "物料产品ID")
    private Long bomId;

    @Excel(name = "物料ID")
    @EQ
    @Schema(description = "物料ID")
    @TableDict(table = "base_material", key = "id" , columns = {
            @DictColumn(name ="material_code", alias = "materialCode"),
            @DictColumn(name = "material_name", alias = "materialName"),
            @DictColumn(name = "spec", alias = "materialSpec")
    })
    private Long materialId;

    @Excel(name = "数量")
    @Schema(description = "数量")
    private BigDecimal qty;

    @Excel(name = "损耗率", readConverterExp = "%=")
    @Schema(description = "损耗率（%）")
    private BigDecimal lossRate;

    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "创建者")
    private Long createBy;

    @TableField(fill = FieldFill.INSERT)
    @Schema(description = "创建时间")
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.UPDATE)
    @Schema(description = "更新者")
    private Long updateBy;

    @TableField(fill = FieldFill.UPDATE)
    @Schema(description = "更新时间")
    private LocalDateTime updateTime;

}